package pers.amos.edu.mapper;

import org.apache.ibatis.annotations.Select;
import pers.amos.edu.pojo.ExaminationPaperEntity;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author amos wong
 * @create 2020-04-12 8:28
 */

public interface ExaminationPaperMapper extends Mapper<ExaminationPaperEntity>{
    @Select(" SELECT *, (SELECT count(*) FROM examination_questions eq where eq.paper_id=ep.id) AS questionsCount FROM examination_paper ep")
    List<ExaminationPaperEntity> getExaminationPaperList();

    @Select("SELECT * FROM examination_paper where id=#{id}")
    ExaminationPaperEntity getExaminationPaperById(int id);
}
